﻿$(function () {
    $(document).ready(function () {
        var url = window.location.href;
        url = url.replace(/\&/g, '%26');
        $.ajax({
            type: "Post",
            url: "/Handler/wxjssdkHandler.ashx",
            //contentType: "application/json; charset=utf-8",
            dataType: "json",
            data: "sendurl=" + url,
            success: function (data) {
                //var data = $.parseJSON(data.d);
                wx.config({
                    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                    appId: data.appid, // 必填，公众号的唯一标识
                    timestamp: data.timestamp, // 必填，生成签名的时间戳
                    nonceStr: data.nonceStr, // 必填，生成签名的随机串
                    signature: data.signature, // 必填，签名，见附录1
                    jsApiList: ['hideMenuItems'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2  
                });
                wx.ready(function () {
                    wx.hideMenuItems({
                        menuList: ['menuItem:share:timeline', 'menuItem:share:qq', 'menuItem:share:appMessage', 'menuItem:share:weiboApp', 'menuItem:favorite', 'menuItem:share:facebook', 'menuItem:share:QZone', 'menuItem:editTag', 'menuItem:delete', 'menuItem:copyUrl', 'menuItem:originPage', 'menuItem:openWithQQBrowser', 'menuItem:openWithSafari', 'menuItem:share:email', 'menuItem:share:brand'] // 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
                    });

                });
               
            }
        });
    });
});
$(function () {
    var ua = navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
        return true;
    } else {
        location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx1bbe4f5c65bb2bbd&connect_redirect=1#wechat_redirect";
    }
});